{include file="public/head" /}
<body>
{include file="public/menu" /}
<div class="recharge">
    <div class="wrap">
        <div class="subnav commonTab">
            <span class="ac">确认支付</span>
        </div>
        <ul id="content">
            <li class="showli">
                <form action="" onSubmit="return false">
                    <h3>
                        <span class="label">订单金额：</span><span class="color">{$data.money}元</span>
                    </h3>
                    <div class="money">
                        <label>订单编号：</label>
                        <span class="color">{$data.order_sn}</span>
                    </div>
                    <div class="money">
                        <label>创建时间：</label>
                        <span class="color">{$data.create_time}</span>
                    </div>
                    <div class="money">
                        <label>支付账户：</label>
                        <span class="color">{$mobile}</span>
						<input type="button" id="getcode2" onclick="getPayCode()" value="验证码已过期" style="width: 20%;display: inline;margin-left:20px;cursor:pointer;">
                    </div>
                    <div class="money">
                        <label>支付验证码：</label>
						<input type="text" id="PayCode" class="recharge-amount amount1"  style="width: 50%;display: inline;">
                    </div>
                    <div class="next next1">
                        <span class="label"></span>
                        <input type="submit" id="QUICKPC" value="确认支付">
                    </div>
                </form>
            </li>
        </ul>
    </div>
</div>
{include file="public/foot" /}
</body>
{include file="public/load_bottom" /}
<script>
    $(function(){
        var subnav = $('.subnav').find('span')
        var li = $('#content').find('li')
        subnav.click(function(){
            $(this).addClass('ac').siblings().removeClass('ac')
            li.eq($(this).index()).addClass('showli').siblings().removeClass('showli')
        })
		settime2()
    })
	$('#QUICKPC').click(function(){
		 var code = $('#PayCode').val();
		 if(code.length!=6){
			layer.msg('请输入正确的验证码');
			return false;
		 }
		 var index = layer.load(0, {shade: false});
		 $('#QUICKPC').attr('disabled',true);
		 $.ajax({
			url: "{:url('Order/confirm')}",
			type:"POST",
			dataType:"JSON",
			data:{id:"{:input('id')}",code:code},
			success:function(msg){
				layer.close(index);
				$('#QUICKPC').attr('disabled',false);
				if(msg.status == 1){
					layer.alert(msg.info,function(){
						window.location.href = msg.url;
					})
				}else{
					layer.msg(msg.info);
				}
			}
		 })
	})

	var countdown2=180;
	function settime2(){
		var val = $("#getcode2");
		if (countdown2 == 0) {
			val.attr('disabled',true)
			val.val("验证码已过期");
			countdown2 = 60;
		} else {
			val.attr('disabled',true)
			val.val(countdown2+"s");
			countdown2--;
			setTimeout(function() {
				settime2()
			},1000)
		}

	}
</script>
</html>